<!DOCTYPE html>
<html>
<body>
<script src="../resources/event-sender-util.js"></script>
<script src="../../../resources/js-test.js"></script>

<div id="host"></div>
<pre id="console"></pre>

<script>
function createBox(name) {
    var div = document.createElement('div');
    div.style.width = '100px';
    div.style.height = '100px';
    div.style.resize = 'both';
    div.style.overflow = 'hidden';
    div.style.background = 'red';

    return div;
}

var shadowRoot = host.attachShadow({mode: 'open'});
var box = createBox('dark');
shadowRoot.appendChild(box);

var x = box.offsetLeft + box.offsetWidth;
var y = box.offsetLeft + box.offsetWidth;

eventSender.mouseMoveTo(x - 7, y - 7);
eventSender.mouseDown();
eventSender.mouseMoveTo(x + 7, y + 7);
eventSender.mouseUp();

shouldBe('box.offsetWidth', '114');
shouldBe('box.offsetHeight', '114');

var successfullyParsed = true;
</script>

</body>
</html>
